﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Boiling.BizFacade;

namespace Boiling.Web
{
    public partial class myBlog : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session.Contents["userID"] == null)
            {
                Response.Redirect("default.aspx");
            }

            string [] myBlogList;
            BlogManager myBlogM = new BlogManager();
            myBlogList = myBlogM.GetDiaryIDbyUserID((string)Session.Contents["userID"]);

            string[] myBlogTitleList = myBlogM.GetDiaryTitleByUserID((string)Session.Contents["userID"]);

            if (Session.Contents["BlogList"] == null)
            {
                Session.Add("BlogList", myBlogList);
                Session.Add("BlogListLength", myBlogList.Length);
                Session.Add("BlogTitleList", myBlogTitleList);
            }
            else
            {
                Session.Contents["BlogList"] =  myBlogList;
                Session.Contents["BlogListLength"] =  myBlogList.Length;
                Session.Contents["BlogTitleList"] = myBlogTitleList;
            }
            
        }
        public void LinkButton_Click(Object sender, EventArgs e)
        {

            if (Session.Contents["userID"] != null)
            {
                Session.Remove("userID");
            }
            Response.Redirect("Default.aspx");
        }
    }
}
